using NetMigration.DAOs;
using NetMigration.DbProviders;
using NetMigration.Domains;
using NetMigration.Factories;
using NetMigration.Services;
using NetMigration.SqlAssemblers;

namespace NetMigration.Factories
{
    public class SQLServerMigrationFactory : IMigrationFactory
    {
        private readonly string connectionString;

        public SQLServerMigrationFactory(string connectionString)
        {
            this.connectionString = connectionString;
        }

        public ITable CreateTableInstance(string tableName)
        {
            return new Table(tableName, new SQLServerProvider(connectionString), new TSqlAssembler());
        }

        public IVersionDAO CreateVersionDAO()
        {
            return new SQLServerVersionDAO(new SQLServerProvider(connectionString), new TSqlAssembler());
        }

        public IVersionService CreateVersionController()
        {
            return new VersionService(this);
        }
    }
}